package pl.edu.mimuw.irs.core.model.analysis.subnet;

import pl.edu.mimuw.irs.core.model.design.IRSActivity;
import pl.edu.mimuw.irs.core.model.petrinet.Net;
import pl.edu.mimuw.irs.core.model.petrinet.Place;
import pl.edu.mimuw.irs.core.model.petrinet.Transition;

@Deprecated
public class ActivitySubnet extends Net {
    
	private static final long serialVersionUID = 445684416670204744L;
	
	// *** Attributes

	private Transition begin;
	private Place allHired;
	private Transition endHiring;
	private Place beforeWork;
	// here comes subnet inside this activity
	private Place afterWork;
	private Transition beginFiring;
	private Place allFired;
	private Transition end;
	public Transition getBegin() {
		return begin;
	}
	public void setBegin(Transition begin) {
		if (this.begin != null) removeNode(this.begin);
		addNode(begin);
		this.begin = begin;
	}
	public Place getAllHired() {
		return allHired;
	}
	public void setAllHired(Place allHired) {
		if (this.allHired != null) removeNode(this.allHired);
		addNode(allHired);
		this.allHired = allHired;
	}
	public Transition getEndHiring() {
		return endHiring;
	}
	public void setEndHiring(Transition endHiring) {
		if (this.endHiring != null) removeNode(this.endHiring);
		addNode(endHiring);
		this.endHiring = endHiring;
	}
	public Place getBeforeWork() {
		return beforeWork;
	}
	public void setBeforeWork(Place beforeWork) {
		if (this.beforeWork != null) removeNode(this.beforeWork);
		addNode(beforeWork);
		this.beforeWork = beforeWork;
	}
	public Place getAfterWork() {
		return afterWork;
	}
	public void setAfterWork(Place afterWork) {
		if (this.afterWork != null) removeNode(this.afterWork);
		addNode(afterWork);
		this.afterWork = afterWork;
	}
	public Transition getBeginFiring() {
		return beginFiring;
	}
	public void setBeginFiring(Transition beginFiring) {
		if (this.beginFiring != null) removeNode(this.beginFiring);
		addNode(beginFiring);
		this.beginFiring = beginFiring;
	}
	public Place getAllFired() {
		return allFired;
	}
	public void setAllFired(Place allFired) {
		if (this.allFired != null) removeNode(this.allFired);
		addNode(allFired);
		this.allFired = allFired;
	}
	public Transition getEnd() {
		return end;
	}
	public void setEnd(Transition end) {
		if (this.end != null) removeNode(this.end);
		addNode(end);
		this.end = end;
	}
	
	// *** Constructors

	public ActivitySubnet(IRSActivity activity) {/*
		setBegin(new Transition("Begin_" + activity.getId(), 
				new Position(activity.getPosition().getX() + 300, activity.getPosition().getY())));
		setAllHired(new Place("AllHired_" + activity.getId(), 
				new Position(activity.getPosition().getX() + 350, activity.getPosition().getY() + 100)));
		//addArc(getBegin(), getAllHired());
		setEndHiring(new Transition("EndHiring_" + activity.getId(), 
				new Position(activity.getPosition().getX() + 400, activity.getPosition().getY() + 100)));
		addArc(getAllHired(), getEndHiring());
		setBeforeWork(new Place("BeforeWork_" + activity.getId(), 
				new Position(activity.getPosition().getX() + 400, activity.getPosition().getY() + 150)));
		addArc(getEndHiring(), getBeforeWork());
		// In here will be connected contained in activity content - this is
		// performed in AnalysisWorkflow.
		setAfterWork(new Place("AfterWork_" + activity.getId(), 
				new Position(activity.getPosition().getX() + 400, activity.getPosition().getY() + 250)));
		setBeginFiring(new Transition("BeginFiring_" + activity.getId(), 
				new Position(activity.getPosition().getX() + 400, activity.getPosition().getY() + 300)));
		addArc(getAfterWork(), getBeginFiring());
		setAllFired(new Place("AllFired_" + activity.getId(), 
				new Position(activity.getPosition().getX() + 350, activity.getPosition().getY() + 350)));
		addArc(getBeginFiring(), getAllFired());
		setEnd(new Transition("End_" + activity.getId(), 
				new Position(activity.getPosition().getX() + 300, activity.getPosition().getY() + 400)));
		addArc(getAllFired(), getEnd());*/
	}
	
	// *** Methods
}
